<template>
    <div class="search">
      <div class="top">
        <span @click="jump" class="back">返回</span>
      </div>
    </div>
    <div class="info" v-if="block">
      <ul>
        <li>姓名：{{ list.name }}</li>
        <li>联系方式：{{ list.phone }}</li>
        <li>毕业学校：{{ list.school }}</li>
        <li>学历：{{ list.education }}</li>
        <li>应聘岗位：{{ list.job }}</li>
        <li>信息来源：{{ list.from }}</li>
        <li>电子邮件：{{ list.email }}</li>
      </ul>
    </div>
    <div v-else class="searchno">
      <h2>未查询到该人员信息</h2>
    </div>
  </template>
  
  <script setup>
  import { onMounted, ref } from "vue";
  import axios from "axios";
  import { useRouter, useRoute } from "vue-router";
  
  var route = useRoute();
  var router = useRouter();
  var block = ref(0);
  var a = ref("");
  a.value = JSON.parse(route.params.name);
  var list = ref({});
  onMounted(() => {
    axios.post("/api/user/search", { name: a.value }).then((res) => {
      if (res.data.code == 1) {
        list.value = res.data.obj;
        block.value = 1;
      } else {
        block.value = 0;
      }
    });
  });
  var jump = () => {
    router.push("/index/goodPerson");
  };
  </script>
  
  <style lang="scss" scoped>
  .top {
    height: 60px;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
  }
  .back {
    display: inline-block;
    width: 50px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    background-color: #fff;
    color: #63b9be;
    cursor: pointer;
    margin-left: 1200px;
    font-size: 12px;
    border-radius: 10px;
  }
  .back:hover {
    color: #fff;
    background-color: #63b9be;
  }
  .info {
    font-size: 12px;
    color: #999;
  }
  ul {
    list-style: none;
  }
  li {
    padding-bottom: 40px;
  }
  .searchno {
    margin-top: 50px;
    text-align: center;
    color: red;
  }
  </style>